﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>代理商管理</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>

    <link rel="stylesheet" type="text/css" href="/static/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/themes/icon.css">
    <link href="/static/files/代理商管理/styles.css" type="text/css" rel="stylesheet"/>
    <script src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery.easyui.min.js"></script>
    <script src="/static/files/代理商管理/data.js"></script>

</head>
<body>
<div id="div0">
    <div id="div1">
        <img id="ua-img" src="static/images/代理商管理/ua.png" width="100%">
        <div id="div11">欢迎您：<span>${loginUser.usercode}</span>
            <a href="#" class="easyui-linkbutton" plain="true" onclick="openUpdate()">修改密码</a>
            <div id="up">
                <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="update()">修改</a>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'"
                   onclick="$('#dd').dialog('close')">取消</a>
            </div>
            &nbsp; <a href="javascript:void(0);" onclick="tuichu()">退出</a></div>
    </div>
    <div id="div2">
        <ul>
            <li class="touBu1"><a href="${pageContext.request.contextPath}/agenZiLianJie" id="head1" class="touBu" target="mainFrame">代理商管理</a></li>
            <li class=""><a href="#" id="head2" class="" target="">门户管理</a></li>
            <li class=""><a href="#" id="head3" class="" target="_parent">报表管理</a></li>
            <li class=""><a href="#" id="head4" class="" target="_parent">系统管理</a></li>
            <li class=""><a href="#" id="head5" class="" target="_parent">系统配置管理</a></li>
        </ul>
    </div>
    <div id="div3">
        <ul>
            <li class=""><a href="${pageContext.request.contextPath}/ak47" class="" target="mainFrame">关键词申请</a></li>
            <li class=""><a href="${pageContext.request.contextPath}/asCustoms" class=""
                            target="mainFrame">代理商客户管理</a></li>
            <li class=""><a href="${pageContext.request.contextPath}/agentPrepayment" class="" target="mainFrame">代理商预付款</a></li>
            <li class=""><a href="${pageContext.request.contextPath}/keyWordMan" class="" target="mainFrame">关键词申请管理</a></li>
            <li class=""><a href="${pageContext.request.contextPath}/log" class="" target="mainFrame">操作日志</a></li>
        </ul>
    </div>
    <div id="div4"><p>代理商管理\当前账户信息</p></div>
    <div id="div5">
      <iframe id="iframSRC" src="/agenZiLianJie" name="mainFrame" frameborder="0">
        <%--这里连接子页面--%>

      </iframe>
    </div>

</div>
<div id="dd" class="easyui-dialog" title="修改密码" style="width:400px;"
     data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:'#up'">
    <form id="ff" style="padding: 10px">
        <div style="margin-bottom:20px">
            <%--
            validType="remote['/update','password']"  获取控制器的url和属性
            invalidMessage="原密码不正确"   提示语
            会自动验证
            --%>
            <input class="easyui-textbox" label="原始密码：" name="password" id="password"
             validType="remote['/update','password']"  invalidMessage="原密码不正确"  style="width:70%;"
            >
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" label="新密码：" type="password" name="userpassword" id="userpassword"
                   style="width:70%;">
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" label="确认密码：" type="password" name="nnpassword" id="nnpassword"
                   style="width:70%">
        </div>
    </form>
</div>

</body>

<%--修改密码--%>
<script>
    function openUpdate() {
        $("#dd").dialog('open');
    }

    function update() {
        if($("#userpassword").val() !== $("#nnpassword").val()){
            alert("两次密码不一致,请重新输入！");
            return;
        }
        $.ajax({
            url:"updatepassword",
            type:"post",
            data:{
                "password":$("#password").val(),
                "userpassword":$("#userpassword").val()
            },
            success:function (data) {
              if(data > 0 ){
                  alert("密码修改成功");
                  $('#dd').dialog('close');// 关闭表格窗口
                  $("#ff").form('clear');// 清空输入框数据

              }else{
                  alert("原密码错误，密码修改失败！")
              }
            }
        })
    }
    
   function tuichu() {
        sessionStorage.clear();
        window.location.reload();
       location.href="/";
    }
</script>
</html>
